package com.wthink.hzgj.copyFile.viewmodel

import android.util.Log
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.wthink.hzgj.service.DevService
import com.wthink.hzgj.util.`interface`.ProgrossCallBack
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.withContext

class CopyProgressDialogModel : ViewModel(){

    val progress = MutableLiveData(0)

    fun waitCopyProcess() {
        viewModelScope.launch(Dispatchers.IO) {
            DevService.listenProcess().collect {
                val pro = it.process
                Log.d("process",pro)
                progress.postValue(pro.toInt())
            }
        }
    }
}